package com.symphony.messagedigest;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import javax.crypto.spec.SecretKeySpec;

public class DigestTest {
	
	public static void main(String [] args) {
		try {
			MessageDigest md = MessageDigest.getInstance("md5");
			String input = "password";
			byte[] inputBytes = md.digest(input.getBytes());
			for(byte b: inputBytes)
				System.out.print(b);
			
			System.out.println("\n");
			
			SecretKeySpec key = new SecretKeySpec(inputBytes, "DESede");
			
			byte[] keyBytes = key.getEncoded();
			for(byte b: keyBytes)
				System.out.print(b);
			
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
	}
}
